import 'package:flutter/material.dart';
import 'package:flutter_basic_learning/utils/CommonWidget.dart';
import 'package:flutter_basic_learning/views/getx/GetRouterPage.dart';
import 'package:get/get.dart';

class HotPage extends StatefulWidget {
  // final Map<String, dynamic> arguments;
  const HotPage({super.key});

  @override
  State<HotPage> createState() => _HotPageState();
}

class _HotPageState extends State<HotPage> {
  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    debugPrint("arguments: ${Get.arguments}");
    // debugPrint("title: ${widget.arguments['title']}");
  }

  Widget rowText(String text) {
    Widget body = Text(
      text,
      style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
    );

    body = Center(child: body);
    body = Container(
        width: double.infinity,
        height: 40,
        margin: const EdgeInsets.only(top: 10),
        color: Colors.orangeAccent,
        child: body);

    return body;
  }

  List<Widget> get rowTextList => [
        rowText('HotPage1'),
        rowText('HotPage2'),
        rowText('HotPage3'),
        rowText('HotPage4'),
        rowText('HotPage5'),
        rowText('HotPage6'),
        rowText('HotPage7'),
        rowText('HotPage8'),
        rowText('HotPage9'),
        rowText('HotPage10'),
        rowText('HotPage11'),
        rowText('HotPage12'),
        rowText('HotPage13'),
        rowText('HotPage14'),
        rowText('HotPage15'),
        rowText('HotPage16'),
        rowText('HotPage17'),
        rowText('HotPage18'),
        rowText('HotPage19'),
        rowText('HotPage20'),
        ElevatedButton(
            onPressed: () {
              Get.offAll(const GetRouterPage());
            },
            child: commonTitle('返回根路由'))
      ];

  Widget body() {
    Widget body = Column(
      crossAxisAlignment: CrossAxisAlignment.center,
      children: rowTextList,
    );
    body = ListView(children: rowTextList);
    return body;
  }

  @override
  Widget build(BuildContext context) {
    debugPrint('方法被嗲用');
    return Scaffold(body: body());
  }
}
